
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>优惠券管理</title>
</head>
<body>
	<nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>  优惠券管理  <span class="c-gray en">&gt;</span> 列表
		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height:1.6em;margin-top:3px" onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新">刷新</a>

	</nav>
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray"> 
			<span class="l"> 
			<a class="btn btn-default title def" id="one" href="<%=path%>/backstage/coupon-list?id=one" >所有优惠券</a>
			<a class="btn btn-default title def" id="two"  href="<%=path%>/backstage/coupon-list?flag_type=1&id=two">即将过期</a>
			<a class="btn btn-default title def" id="three" href="<%=path%>/backstage/coupon-list?flag_type=2&id=three" >已结束</a>
			</span>
		 </div>
		 
		 
	<div class="mt-20"></div>
		<div class="cl pd-5 bg-1 bk-gray"> 
		<form action="<%=path%>/backstage/coupon-list" method="get" class="form form-horizontal" id="search-form">
		<input type="hidden" id="id" name="id" value='${id}' />
		<div class="text-c"> 
		
			<div class="row cl">
				<label class="form-label col-1">优惠券分类:</label>
				<div class="formControls col-2">
					<span class="select-box"> <select name="coupon_cate_id"
						class="select">
							<option value="-1">--全部--</option>								
							<c:forEach items="${match_classifys_list}" var="classifys">
								<option value="${classifys.item_value}" 
									<c:if test="${coupon_cate_id==classifys.item_value}">selected</c:if>>${classifys.display_name}
								</option>					
							</c:forEach>	
															
					</select>
					</span>
				</div>
			
				<label class="form-label col-1">优惠类型:</label>
				<div class="formControls col-2">
					<span class="select-box"> <select name="coupon_type"
						class="select">
							<option value="-1">--全部--</option>
							<c:forEach items="${match_preferentias_list}" var="preferentias">
								<option value="${preferentias.item_value}" 
									<c:if test="${coupon_type==preferentias.item_value}">selected</c:if>>${preferentias.display_name}
								</option>					
							</c:forEach>
					</select>
					</span>
				</div>
			
			
				<button name="" id="" class="btn btn-success"
					style="border-radius: 5px; float: right;" type="submit">
					搜索</button>
				<div style="width: 10px; height: 5px; float: right;"></div>		
			</div>
		</div>
		</form>
	</div>


		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">	                       
                            <th width="80">优惠券分类</th>                  
                            <th width="80">优惠类型</th>             
                            <th width="80">有效期至</th>
      						<th width="80">剩余数量</th>
                            <th width="80">押金金额</th>
                            <th width="80">状态</th>            
						<th width="100">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${u_coupons}" var="u_coupon">					
						<tr class="text-c">
							
                            <td>                      
				            <input type="hidden" id="id" name="id" value='${u_coupon.coupon_id}'></input>
	                            <c:if test="${1==u_coupon.coupon_cate_id}">
	                            	购物
	                            </c:if>
	                            <c:if test="${0==u_coupon.coupon_cate_id}">
	                            	美食
	                            </c:if>
                            </td>                             
                            <td>                       
                              	<c:if test="${u_coupon.coupon_type==1}">
                              		满减券
                              	</c:if> 
                     		    <c:if test="${u_coupon.coupon_type==2}">
                     		    	抵用券
                     		    </c:if>
                            </td>          
                            <td>${u_coupon.end_time}</td>                          
                            <td>${u_coupon.ext1}</td>
                            <td>${u_coupon.deposit_amount}</td>
                            <td>
	                            <c:if test="${2==u_coupon.ext2}">
	                            	进行中
	                            </c:if>
	                   			<c:if test="${1==u_coupon.ext2}">
	                   				即将到期
	                   			</c:if>
	                   			<c:if test="${0==u_coupon.ext2}">
	                   				已结束
	                   			</c:if>
                            </td>
							<td class="td-manage">
								<a class="btn btn-warning"
									onClick="u_coupon_edit(this,'${u_coupon.coupon_id}')" href="javascript:void(0);"
									title="编辑">编辑</a>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<a class="btn btn-primary"
									onClick="u_coupon_delete(this,'${u_coupon.coupon_id}')" href="javascript:void(0);"
									title="删除">删除</a>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript" src="js/u_coupon_list.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 0, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 1, 2 ]
				} // 制定列不参与排序
				]
			});
		
			var ids = document.getElementById("id").value;
			if(ids == ''){
				var obj = document.getElementById('one');
				obj.className = "btn btn-default btn-warning title rleft def";
			}else{				
				var obj = document.getElementById(ids);
				obj.className = "btn btn-default btn-warning title rleft def";
			}
			
		});

		/*删除*/
		function u_coupon_delete(obj,id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/u_coupon-delete",
					data : "id=" + id,
					error : function() {
						layer.msg('操作失败', {icon:5,time:1000});
					},
					success : function(msg) {
						layer.msg('已删除 ', {icon:6,time:1000});
						$(obj).parents("body").find(".btn-refresh").click();
					}
				});
			},
			function(){
				layer.msg('未删除', {icon:5,time:1000});
			});	
		}
		
		
		function u_coupon_edit(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/coupon-add-pre?id="+id;
			layer_show("编辑",edit_page,w,h);
		}
				
	</script>
</body>
</html>



